home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1986 November & December / rerun-1986-11-12.d64 / mag reader v7.2 (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  6KB  |  225 lines

  1. 0 goto 100
  2. 1 rem mag reader v7.2
  3. 2 rem (c) 1986 david a. hook
  4. 3 :
  5. 9 rem display a screen
  6. 10 print "[147][146]";: open 2, 8, 2, f$
  7. 11 for i = fl to ll
  8. 12 print# 15, "p" + chr$(2) + chr$(i and 255) + chr$(i/256) + chr$(1)
  9. 13 sys ad
  10. 14 l=peek(142)
  11. 15 print left$(a$,l);
  12. 16 ifl<40 then print chr$(13);
  13. 17 poke 212, 0: next: close 2: return
  14. 18 :
  15. 100 if lk goto 600: rem after picture loads
  16. 110 poke 55, 0: poke 56, 32: clr
  17. 120 a$="abcdefghijklmnopqrst": a$=a$+a$
  18. 130 :
  19. 140 rem bkgd, char colors
  20. 150 read bb, ch
  21. 160 poke 53280, bb: poke 53281, bb: poke 646, ch
  22. 170 :
  23. 180 rem pic name, type, border color
  24. 190 read pf$, t$, kf
  25. 200 poke 2, 2 + 2*(t$="k") + (t$="d")
  26. 202 rem # extra pictures
  27. 203 read e
  28. 205 if e=0 goto 230
  29. 207 dim p(e), f$(e), t$(e), c(e)
  30. 208 for i=1 to e: read p(i), f$(i), t$(i), c(i)
  31. 209 if t$(i)="k" then f$(i)=chr$(129)+left$(f$(i)+"        ",14)
  32. 211 if t$(i)="d" then f$(i)="dd"+f$(i)
  33. 212 next
  34. 214 ps=0: pl=0
  35. 220 rem issue file name
  36. 230 read f$
  37. 240 :
  38. 250 rem mag title, issue month
  39. 260 read mt$, mo$
  40. 270 :
  41. 280 cd$=""
  42. 290 sp$="                                      "
  43. 300 :
  44. 310 gosub 1000: rem help
  45. 320 :
  46. 330 lp=25: ad=896: ml=49152: if peek(ad)-160 then gosub 8000: rem read data
  47. 340 :
  48. 350 open 15, 8, 15, "i0"
  49. 360 :
  50. 370 rem get total line count
  51. 380 open 2, 8, 2, f$
  52. 390 sys ad
  53. 400 ln=val(a$)-1: pg=ln/lp
  54. 410 close 2
  55. 420 if ln<1 or pg<>int(pg) then print: print " file error": close 15: stop
  56. 430 :
  57. 440 rem skip the load if no hi-res picture included
  58. 450 lk=1: if peek(2)>1 then lk=2: goto 600
  59. 460 :
  60. 470 rem add special characters to picture file name
  61. 480 if t$="k" then pf$=chr$(129)+left$(pf$+"        ",14)
  62. 490 if t$="d" then pf$="dd"+pf$
  63. 500 :
  64. 510 load pf$, 8, 1
  65. 520 :
  66. 530 end: rem never gets here
  67. 540 :
  68. 599 rem display picture
  69. 600 gosub 2000
  70. 601 gosub 2100
  71. 610 :
  72. 799 rem main loop
  73. 800 gosub 5000: rem screen prompt
  74. 810 gosub 3000: rem get fn key
  75. 820 goto 800
  76. 830 :
  77. 999 rem help screen
  78. 1000 print "[147]"; tab(14); "[200]elp [211]creen"
  79. 1010 print tab(14); "[163][163][163][163][163][163][163][163][163][163][163]"
  80. 1020 print "   [217]ou may return here by pressing f2[146]."
  81. 1030 print " f1[146] -- [212]able of [195]ontents"
  82. 1040 print " f2[146] -- [212]his [200][197][204][208] [211]creen"
  83. 1050 print " f3[146] -- [199]o to a [211]creen (by its number)"
  84. 1060 print " f5[146] -- [208]revious [211]creen"
  85. 1070 print " f7[146] -- [206]ext [211]creen"
  86. 1080 print " f8[146] -- [209]uit [205]agazine"
  87. 1090 print "   [212]hese programs were developed by:"
  88. 1100 print tab(13); "[196]avid [193]. [200]ook"
  89. 1110 print "    for the [194][193][210][210][201][197] [213][211][197][210] [199][210][207][213][208] ([194][213][199])"
  90. 1120 print "   [197]ntire contents of this magazine are"
  91. 1130 print " (c) 1986 by the [193]uthors within."
  92. 1140 if lk then sc=0: goto 5000
  93. 1150 print "   [211]trike [211][208][193][195][197] to exit the cover page."
  94. 1160 if peek(2)<>2 then m$="([201]t's now loading...)": gosub 5200: print
  95. 1170 m$="[208]lease [211]tand [194]y..."
  96. 1180 goto 5100
  97. 1190 :
  98. 1999 rem display picture
  99. 2000 if lk=2 goto 2040
  100. 2010 poke 53280, kf: sys ml
  101. 2020 :
  102. 2030 rem wait for a key press
  103. 2040 poke 198, 0: wait 198, 1
  104. 2050 poke 53265, peek(53265) and 223
  105. 2060 poke 53270, peek(53270) and 239
  106. 2070 poke 53272, (peek(53272) and 240) or 4
  107. 2080 poke 53280, bb: poke 53281, bb: poke 646, ch
  108. 2081 print "[147][146]": return
  109. 2090 :
  110. 2100 rem monthly issue screen
  111. 2110 print "[147][146]";
  112. 2120 m$=mt$: gosub 5200
  113. 2130 print: print: m$=mo$: gosub 5200
  114. 2140 sc=0
  115. 2150 :
  116. 2160 return
  117. 2170 :
  118. 2999 rem get a function key
  119. 3000 cp=sc
  120. 3010 get k$: if k$<"[133]" or k$>"[140]" goto 3010
  121. 3020 on asc(k$)-132 gosub 3100, 3300, 3500, 3700, 3200, 3030, 3030, 3800
  122. 3030 return
  123. 3040 :
  124. 3100 sc=1: gosub 4000: goto 10
  125. 3110 :
  126. 3200 goto 1000
  127. 3210 :
  128. 3300 m$="[211][195][210][197][197][206] " + str$(cp)+ "  [197]nter [208]age # ?[157]": gosub 5100
  129. 3310 gosub 6000: if sc=0 goto 2000
  130. 3320 gosub 4000: goto 10
  131. 3330 :
  132. 3500 sc=cp-1: gosub 4000: if sc=0 goto 2000
  133. 3510 goto 10
  134. 3520 :
  135. 3700 sc=cp+1: gosub 4000: goto 10
  136. 3710 :
  137. 3800 close 15: poke55, 0: poke 56, 160: clr: end
  138. 3810 :
  139. 3999 rem set page parameters
  140. 4000 if sc>pg then sc=pg
  141. 4010 if sc<1 then sc=0: goto 4030
  142. 4020 fl=(sc-1)*lp + 2: ll=sc*lp + 1
  143. 4022 if e=0 goto 4030
  144. 4024 of=0: if sc<cp then of=-1
  145. 4026 ps=0: for i=1 to e: if p(i)+of=sc then ps=i
  146. 4027 next
  147. 4028 if ps then gosub 4501
  148. 4030 return
  149. 4040 :
  150. 4499 rem load/view extra pics
  151. 4501 if ps=pl goto 4601
  152. 4521 pl=ps: t$=t$(ps): kf=c(ps)
  153. 4531 poke 2, 2 + 2*(t$="k") + (t$="d")
  154. 4551 open 1, 8, 8, f$(ps)
  155. 4561 poke 780, 1: poke 781, 8: poke 782, 0: sys 65466
  156. 4571 poke 780, 0: poke 781, 0: poke 782, 96 + 4*(t$="d"): sys 65493
  157. 4581 close 1
  158. 4601 goto 2000
  159. 4999 rem normal screen prompt
  160. 5000 sc$=str$(sc)
  161. 5010 m$="[208]ress 'f2' for [200][197][204][208] -- [211][195][210][197][197][206] " + sc$
  162. 5020 :
  163. 5099 rem message on last screen line
  164. 5100 print cd$; ""; sp$; cd$;
  165. 5110 :
  166. 5199 rem center a message
  167. 5200 print spc((40-len(m$))/2); m$;
  168. 5210 return
  169. 5220 :
  170. 5999 rem input up to 4 digits
  171. 6000 sc$="": k=0
  172. 6010 get k$: if k$="" goto 6010
  173. 6020 if k$=chr$(13) and k>0 then print k$: goto 6080
  174. 6030 if k$=chr$(20) and k>0 then k=k-1: sc$=left$(sc$,k): print k$;
  175. 6040 if k=4 then print: goto 6080
  176. 6050 if k$<"0" or k$>"9" goto 6010
  177. 6060 sc$=sc$+k$: k=k+1: print k$;
  178. 6070 goto 6010
  179. 6080 sc=val(sc$): return
  180. 6090 :
  181. 6999 rem bkgd, char colors
  182. 7000 data  1, 14
  183. 7010 :
  184. 7099 rem pic name, type, border color
  185. 7100 data "may 86 bug", "k", 14
  186. 7110 :
  187. 7119 rem # extra pics
  188. 7121 data 5
  189. 7149 rem page, name, type, border
  190. 7151 data 3, "pic j flags", "k", 12
  191. 7152 data 8, "lady", "d", 13
  192. 7153 data 12, "blue jays", "k", 6
  193. 7154 data 18, "middle earth", "d", 1
  194. 7155 data 24, "pic o amiga", "k", 7
  195. 7156 :
  196. 7199 rem issue file name
  197. 7200 data "demo"
  198. 7210 :
  199. 7299 rem mag title, issue month
  200. 7300 data "[193] [196][197][205][207] [206]ewsletter", "[202]uly 1986"
  201. 7310 :
  202. 7999 rem read & store ml
  203. 8000 ck=0: for i=ad to ad+41: read da: poke i,da: ck=ck+da: next
  204. 8010 if ck<>6121 then print "error in data": stop
  205. 8020 :
  206. 8030 ck=0: for i=ml to ml+127: read da: poke i,da: ck=ck+da: next
  207. 8040 if ck<>17262 then print "error in data": stop
  208. 8050 :
  209. 8060 return
  210. 8070 :
  211. 8080 rem c64 string thing data (file 2)
  212. 8090 data 160,2,177,45,153,137,0,200,192,6,208,246,162,2
  213. 8100 data 32,198,255,32,228,255,201,13,240,15,164,142,145,140
  214. 8110 data 200,132,142,196,139,240,4,165,144,240,234,76,204,255
  215. 8120 :
  216. 8130 rem ml data for mag display
  217. 8140 data 173,17,208,41,239,141,17,208,164,2,208,43,169,40,133,251
  218. 8150 data 162,131,134,252,162,4,169,216,160,0,32,109,192,173,22,208
  219. 8160 data 41,191,9,16,141,22,208,173,16,135,141,33,208,169,64,133
  220. 8170 data 251,162,127,134,252,208,8,169,0,133,251,162,92,134,252,169
  221. 8180 data 4,170,160,0,32,109,192,132,251,162,96,134,252,162,32,169
  222. 8190 data 32,32,109,192,173,17,208,9,34,141,17,208,173,24,208,9
  223. 8200 data 8,141,24,208,173,17,208,9,16,141,17,208,96,132,253,133
  224. 8210 data 254,177,251,145,253,200,208,249,230,252,230,254,202,208,242,96
  225.